package com.wc.alorithm_blue_bridge._枚举.残缺的数字;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

/**
 * @Author congge
 * @Date 2025/4/28 17:29
 * @description
 * https://www.lanqiao.cn/problems/17114/learning/?problem_list_id=32&page=1
 */
public class Main {
    /**
     * 思路：暴力枚举每一种可能然后乘起来即可
     */
    static FastReader sc = new FastReader();
    static PrintWriter out = new PrintWriter(System.out);
    static int N = 10;
    static int[] num = new int[]{1111110, 110000, 1101101, 1111001, 110011, 1011011, 1011111, 1110000, 1111111, 1111011};
    static int n = 18;

    public static void main(String[] args) {
        long res = 1;
        for (int i = 1; i <= n; i++) {
            int x = sc.nextInt(), k = 0;
            for (int j = 0; j < N; j++) {
                int y = num[j], z = x;
                while (y > 0 || z > 0) {
                    if ((z % 10 == y % 10) || (z % 10 == 0 && y % 10 == 1)) {
                        z /= 10;
                        y /= 10;
                    } else break;
                }
                if (y == z && z == 0) k++;
            }
            res *= k;
        }
        out.println(res);
        out.flush();
    }
}

class FastReader {
    StringTokenizer st;
    BufferedReader br;

    FastReader() {
        br = new BufferedReader(new InputStreamReader(System.in));
    }

    String next() {
        while (st == null || !st.hasMoreElements()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return st.nextToken();
    }

    int nextInt() {
        return Integer.parseInt(next());
    }

    String nextLine() {
        String s = "";
        try {
            s = br.readLine();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return s;
    }

    long nextLong() {
        return Long.parseLong(next());
    }

    double nextDouble() {
        return Double.parseDouble(next());
    }

    // 是否由下一个
    boolean hasNext() {
        while (st == null || !st.hasMoreTokens()) {
            try {
                String line = br.readLine();
                if (line == null)
                    return false;
                st = new StringTokenizer(line);
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return true;
    }
}

